<html>
	{% include "../common_head.html" %}
	<body>
	{% include "../common_menus.html" %}
	<div id="content">
		<div id="rakontu_form_style" class="rakontu_form">
		<form action="/{{dir_visit}}/{{url_filter}}
		{% if current_filter %}
			?{{current_filter.urlQuery}}
		{% else %}
			?{{rakontu.urlQuery}}
		{% endif %}
		{% if location %}
			&{{url_query_location}}={{location}}
		{% endif %}
		{% if member_to_see %}
			&{{member_to_see.urlQuery}}
		{% endif %}
		{% if character %}
			&{{character.urlQuery}}
		{% endif %}
		" method="post">
	
		<h3>{{template_filter_name_and_comment}}</h3>
		<fieldset>
		<p>{{template_name}} 
		<input name="filterName" type="text" size="60" maxlength="{{maxlength_name}}" value="{{current_filter.name}}">
		{{"filter_names"|tip}}
		<p>{{template_filter_should_be_shared}}
		<select name="privateOrSharedFilter">
			<option value="private"
			{% if current_filter and current_filter.private %}
				selected="selected"
			{% endif %}
			>{{template_keep_filter_private}}</option>
			<option value="shared"
			{% if current_filter and current_filter.notPrivate %}
				selected="selected"
			{% endif %}
			>{{template_share_filter}}</option>
		</select>
		{{"private_versus_shared_filters"|info}}
		<p>{{template_comment}} {{"filter_comments"|tip}}</p>
		<table style="width:100%; border:none">
		<tr><td class="noborder">
		<textarea name="comment" rows="4" cols="60">{% if current_filter %}{{current_filter.comment}}{% endif %}</textarea>
		</td><td class="noborder" width="80">
		<p>{{template_interpret_as}} {{"interpreting_texts"|tip}}</p>
			<select name="comment_format">
			{% for i in text_formats|makeRangeFromListLength %}
				<option value="{{text_formats|listLookup:i}}" 
				{% if current_filter %}
					{% if text_formats|listLookup:i|equalTest:current_filter.comment_format %}
						selected="selected"
					{% endif %}
				{% else %}
					{% if text_formats|listLookup:i|equalTest:current_member.preferredTextFormat %}
						selected="selected"
					{% endif %}
				{% endif %}
				>{{text_formats_display|listLookup:i}}</option>
			{% endfor %}
			</select>
		</td></tr></table>
		</p>	
		</fieldset>	

		<h3>{{template_filter_selections}}</h3>
		<fieldset>
		<p>
		<select name="overall_anyOrAll">
		{% for i in any_or_all_choices|makeRangeFromListLength %}
			<option value="{{any_or_all_choices|listLookup:i}}"
			{% if current_filter %}
				{% if any_or_all_choices|listLookup:i|equalTest:current_filter.overall_anyOrAll %}
					selected="selected"
				{% endif %}
			{% endif %}
			>{{any_or_all_choices_display|listLookup:i}}</option>
		{% endfor %}
		</select>
		{{template_of_these_selection_criteria}}:</p>
		<hr>
		
		<p> 
		<select name="words_anyOrAll">
		{% for i in any_or_all_choices|makeRangeFromListLength %}
			<option value="{{any_or_all_choices|listLookup:i}}"
			{% if current_filter %}
				{% if any_or_all_choices|listLookup:i|equalTest:current_filter.words_anyOrAll %}
					selected="selected"
				{% endif %}
			{% endif %}
			>{{any_or_all_choices_display|listLookup:i}}</option>
		{% endfor %}
		</select>
		{{template_of_these_words_or_phrases}}:
		{% for i in num_filter_fields|makeRange %} 
			<input name="words|{{i}}" type="text" 
			{% if current_filter %}
				value="{{current_filter.words|listLookup:i|orNothing}}"
			{% endif %}
			size="16" maxlength="{{maxlength_tag_or_choice}}"> 
		{% endfor %}
		<br/>
		&nbsp; &nbsp; 
		{% for i in filter_locations|makeRangeFromListLength %}
			<input type="checkbox" name="location|{{i}}" value="yes" id="location|{{i}}"
			{% if current_filter %}
				{% if current_filter.words_locations|listLookup:i %}
					checked
				{% endif %}
			{% else %}
				{% ifequal i 0 %}
					checked
				{% endifequal %}
			{% endif %}
			>
			<label for="location|{{i}}">{{filter_locations_display|listLookup:i}}</label>&nbsp; &nbsp; 
		{% endfor %}
		{{"filter_word_locations"|tip}}</p>
		
		<hr>
		<p>
		<select name="tags_anyOrAll">
		{% for i in any_or_all_choices|makeRangeFromListLength %}
			<option value="{{any_or_all_choices|listLookup:i}}"
			{% if current_filter %}
				{% if any_or_all_choices|listLookup:i|equalTest:current_filter.tags_anyOrAll %}
					selected="selected"
				{% endif %}
			{% endif %}
			>{{any_or_all_choices_display|listLookup:i}}</option>
		{% endfor %}
		</select>
		{{template_of_these_tags}}:
		{% for i in num_filter_fields|makeRange %} 
				{% if already_there_tags %}
					<select name="tags|{{i}}">
					<option value="none">({{term_choose}})</option>
					{% for tag in already_there_tags %}
						{% if tag|orNothing %}
							<option value="{{tag}}"
							{% if current_filter %}
								{% if current_filter.tags|listLookup:i|equalTest:tag %}
									selected="selected"
								{% endif %}
							{% endif %}
							>{{tag}}</option>
						{% endif %}
					{% endfor %}
					</select>
				{% endif %}
		{% endfor %}
		</p>
		
		<hr>
		<p>
		<select name="entryQuestions|anyOrAll">
		{% for i in any_or_all_choices|makeRangeFromListLength %}
			<option value="{{any_or_all_choices|listLookup:i}}"
			{% if current_filter %}
				{% if any_or_all_choices|listLookup:i|equalTest:entry_questions_any_or_all %}
					selected="selected"
				{% endif %}
			{% endif %}
			>{{any_or_all_choices_display|listLookup:i}}</option>
		{% endfor %}
		</select> {{template_of_these_answers_to_questions_about_entries}} {{"filtering_for_questions"|tip}}</p>
		{{entry_questions_html}}
		
		<hr>
		<p>
		<select name="creatorQuestions|anyOrAll">
		{% for i in any_or_all_choices|makeRangeFromListLength %}
			<option value="{{any_or_all_choices|listLookup:i}}"
			{% if current_filter %}
				{% if any_or_all_choices|listLookup:i|equalTest:creator_questions_any_or_all %}
					selected="selected"
				{% endif %}
			{% endif %}
			>{{any_or_all_choices_display|listLookup:i}}</option>
		{% endfor %}
		</select> {{template_of_these_answers_to_questions_about_creators_of_entries}}</p>
		{{creator_questions_html}}
	
		</fieldset>
		
		<p></p>
		<center>
		<input type="submit" name="save" value="
			{% if member_to_see or character or entry %}
				{% if member_to_see %}
					{{button_save_and_apply_to_member}}
				{% endif %}
				{% if character %}
					{{button_save_and_apply_to_character}}
				{% endif %}
			{% else %}
				{{button_save_and_apply_to_home_page}}
			{% endif %}
			" class="button">&nbsp; 
		{% if current_filter %}
			{% ifequal current_member.key current_filter.creator.key %}
				<input type="submit" name="saveAs" value="
					{% if member_to_see or character or entry %}
						{% if member_to_see %}
							{{button_save_as_new_filter_and_apply_to_member}}
						{% endif %}
						{% if character %}
							{{button_save_as_new_filter_and_apply_to_character}}
						{% endif %}
					{% else %}
						{{button_save_as_new_filter_and_apply_to_home_page}}
					{% endif %}
					" class="button">&nbsp; 
				<input type="submit" name="deleteFilterByCreator" value="{{button_delete}}" class="button">&nbsp; 
			{% endifequal %}
		{% endif %}
		{% if current_filter and current_filter.notPrivate %}
			{% if current_member.isCuratorOrManagerOrOwner %}
				{% if current_filter.flaggedForRemoval %}
					<input type="submit" name="flagFilterByCurator" value="{{button_unflag}}" class="button">&nbsp; 
				{% else %}
					<input type="submit" name="flagFilterByCurator" value="{{button_flag}}" class="button">&nbsp; 
				{% endif %}
			{% endif %}
			{% if current_member.isManagerOrOwner %}
				{% ifnotequal current_member.key current_filter.creator.key %}
					<input type="submit" name="removeFilterByManager" value="{{button_delete}}" class="button">&nbsp; 
				{% endifnotequal %}
			{% endif %}
		{% endif %}	
		</center>

	</form>	
	</div>
		
	</div>
	{% include "../common_footer.html" %}
	</body>
</html>
